class Date implements Comparable<Date> {
	public int day;
	public int month;
	public int year;
	public Date (int d, int m, int y) {
		this.day = d;
		this.month = m;
		this.year = y;
	}

	public int compareTo(Date o) {
		if (!(o instanceof Date))
			return -1;

		Date other = (Date)o;

		if (this.year < other.year)
			return -1;
		if (this.year > other.year)
			return 1;

		if (this.month < other.month)
			return -1;
		if (this.month > other.month)
			return 1;

		if (this.day < other.day)
			return -1;
		if (this.day > other.day)
			return 1;

		return 0;
	}

	public String toString() {
		return "" + year + " " + month + " " + day;
	}
}

public class Problem19 {

	public static void main(String[] args) {
		Date d = new Date(31, 12, 1899);
		Date start = new Date(1,1, 1901);
		Date end = new Date(31, 12, 2000);

		int sum = 0;
		while (true) {
			next_sunday(d);
			if (d.compareTo(end) > 0)
				break;

			if (d.compareTo(start) < 0)
				continue;

			if(d.day == 1)
				sum++;
		}

		System.out.println("" + sum);
	}

	private static void next_sunday(Date date) {
		int days = 0;
		if (date.month == 9 || date.month == 4 || date.month == 6 || date.month == 11)
			days = 30;
		else if (date.month == 2) {
			if (date.year%4 == 0 || (date.year%100 == 0 && date.year%400 == 0))
				days = 29;
			else
				days = 28;
		} else
			days = 31;

		if (date.day <= days - 7)
			date.day += 7;
		else {
			date.day = date.day + 7 - days;
			if (date.month < 12)
				date.month ++;
			else {
				date.month = 1;
				date.year ++;
			}
		}
	}
}
